package cn.itsource.autoconfigure;

import cn.itsource.config.WechatProperties;
import cn.itsource.service.WechatService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({WechatProperties.class})
public class WechatAutoConfiguration {
    /**
     * spring 在加载WeChatService 这个bean
     * 发现你是有参数的  spring就会再容器里面去找对应的Bean(WeChatProperties)
     * @param weChatProperties
     * @return
     */
    @Bean
    public WechatService weChatService(WechatProperties weChatProperties){
        return new WechatService(weChatProperties);
    }

}
